using ACM.MES.BasicManagement;
using ACM.MES.BasicManagement.Localization;
using ACM.MES.Core;
using ACM.MES.FileManagement;
using ACM.MES.LanguageManagement;

namespace ACM.MES
{
    [DependsOn(
        typeof(MESCoreModule),
        typeof(BasicManagementDomainSharedModule),
        typeof(DataDictionaryManagementDomainSharedModule),
        typeof(NotificationManagementDomainSharedModule),
        typeof(LanguageManagementDomainSharedModule),
        typeof(FileManagementDomainSharedModule)
    )]
    public class MESDomainSharedModule : AbpModule
    {
        public override void PreConfigureServices(ServiceConfigurationContext context)
        {
            MESGlobalFeatureConfigurator.Configure();
            MESModuleExtensionConfigurator.Configure();
        }

        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            Configure<AbpVirtualFileSystemOptions>(options => { options.FileSets.AddEmbedded<MESDomainSharedModule>(MESDomainSharedConsts.NameSpace); });

            Configure<AbpLocalizationOptions>(options =>
            {
                options.Resources
                    .Add<MESResource>(MESDomainSharedConsts.DefaultCultureName)
                    .AddVirtualJson("/Localization/MES")
                    .AddBaseTypes(typeof(BasicManagementResource))
                    .AddBaseTypes(typeof(AbpTimingResource));

                options.DefaultResourceType = typeof(MESResource);
            });

            Configure<AbpExceptionLocalizationOptions>(options => { options.MapCodeNamespace(MESDomainSharedConsts.NameSpace, typeof(MESResource)); });
        }
    }
}